<template>
	<el-table ref="singleTableRef" :data="users" highlight-current-row style="width: 100%">
		<el-table-column prop="userId" label="工号" width="120" />
		<el-table-column prop="userName" label="姓名" width="120" />
		<el-table-column prop="userSex" label="性别" width="120" />
		<el-table-column prop="userAge" label="年龄" width="120" />
		<el-table-column prop="userDepartment" label="部门" width="120" />
		<el-table-column prop="postName" label="岗位" width="120" />
		<el-table-column prop="userPower" label="权限" width="120" />
		<el-table-column prop="userSalary" label="月薪" width="120" />
		<el-table-column prop="userPhonenum" label="电话号码" width="120" />
	</el-table>
</template>

<script>
	import {
		ref
	} from 'vue'
	import {
		ElTable
	} from 'element-plus'
	import qs from 'qs'
	export default {
		data() {
			return {
				user: {},
				users: [

				],
			}
		},
		methods: {
			onSubmit() {
				console.log(this.user)
				let that = this
				let str = qs.stringify(this.user)
				this.$axios.get("http://localhost:8080/user/insert?" + str).then(function(res) {
					console.log(res);
				})
			},
			getAllusers() {
				let that = this
				let str = qs.stringify(this.user)
				console.log(this.user)
				this.$axios.get("http://localhost:8080/user/search?" + str).then(function(res) {
					console.log(res);
					that.users = res.data;
					console.log(that.users);
				})
			}
		},
		created() {
			this.getAllusers()
		}

	}
</script>
<style>
	margin: 10 auto;
</style>>
